<!--
/**************************************************
* @(#)organizationview.jsp
*
* Copyright (c) 2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/2/14, owen xia
*  1) first release
   2) add javascript method changelist2,implemnt select jump
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8"%>

<%@ include file="../common.jsp"%>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>
<SCRIPT language="JavaScript" src="<%=root%>/js/hi-check.js"></SCRIPT>
<%@ taglib uri="../WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="../WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="../WEB-INF/struts-logic.tld" prefix="logic"%>
<%session.removeAttribute("GSOrganizationScanQueryForm"); %>
<html>
<head>
<title>组织机构管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK rel="stylesheet" href="css/caigouxitong.css">
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
</head>
<%
String tReQuery = (String)request.getAttribute("requery");
%>

<script language="JavaScript">
function process(val){
      var iFields1 = new Array(2);
      
      iFields1[0] = 'gsorgid||机构编码||N||1-4||#0';
      iFields1[1] = 'gsorgname||机构名称||N||1-50||##';
     
      if( HiScript.value(checkform.name,iFields1) == false)  return false;
      
      if(val == 'Q' || val == 'Qre'){
				  if (val == 'Qre') {
					<%
					    if(tReQuery!=null && tReQuery.equals("true")){
					%>
						checkform.gsorgid.value="<%=(String)request.getAttribute("s_gsorgid")%>";
						checkform.gsorgname.value="<%=(String)request.getAttribute("s_gsorgname")%>";
					    checkform.action='<%= response.encodeURL(request.getContextPath() + "/A400402.do") %>';
                        checkform.submit();
                        return true;
			    	<%}%>
		    	} else if (val == 'Q') {
						checkform.action='<%= response.encodeURL(request.getContextPath() + "/A400402.do") %>';
                        checkform.submit();
                        return true;
		    	}
    	
		}
     
 }

function add(){
   
        var result = null;	
		result = showModalDialog("<%= response.encodeURL(request.getContextPath() + "/A400403.do") %>", window,"status:no;unadorned:no;dialogWidth:900px;dialogHeight:600px;help:no;");
		if(result != null){
		
		   orgform.gs_org_id.value=result[0];
           orgform.gs_org_name.value=result[1];
           orgform.gs_org_addr.value=result[2];
           orgform.gs_org_post.value=result[3];
           orgform.gs_org_phone.value=result[4];
           orgform.gs_org_fax.value=result[5];
           orgform.gs_principal_name.value=result[6];
           orgform.gs_principal_phone.value=result[7];
           orgform.gs_principal_email.value=result[8];
           orgform.gs_upper_orgId.value=result[9];
           orgform.gs_is_stock.value = result[10];
           
           orgform.action="<%= response.encodeURL(request.getContextPath() + "/A400404.do") %>";   
		   orgform.submit();
			}
    return true;
}
function clean(){
      checkform.gsorgid.value ="";
	  checkform.gsorgname.value="";		
	  
}
function mod(temp){
    pager.orgid.value=temp;
    var id=null;
    id= pager.orgid.value;
    var result = null;	
    result = showModalDialog("<%= response.encodeURL(request.getContextPath() + "/A400405.do") %>?orgid="+id, window,"status:no;unadorned:no;dialogWidth:900px;dialogHeight:600px;help:no;");
    if(result != null){
        orgform.gs_org_id.value=result[0];
        orgform.gs_org_name.value=result[1];
        orgform.gs_org_addr.value=result[2];
        orgform.gs_org_post.value=result[3];
        orgform.gs_org_phone.value=result[4];
        orgform.gs_org_fax.value=result[5];
        orgform.gs_principal_name.value=result[6];
        orgform.gs_principal_phone.value=result[7];
        orgform.gs_principal_email.value=result[8];
        orgform.gs_upper_orgId.value=result[9];
        orgform.gs_is_stock.value = result[10];  
                    
        orgform.s_gsorgid.value = checkform.gsorgid.value;           
        orgform.s_gsorgname.value = checkform.gsorgname.value;        
   
        orgform.action="<%= response.encodeURL(request.getContextPath() + "/A400406.do") %>";   
        orgform.submit();
    }
    return true;
}
  
function del(temp){
  if (confirm("是否删除此组织机构？")) {
   pager.orgid.value=temp;
   delform.orgid.value=temp;
   
   delform.s_gsorgid.value = checkform.gsorgid.value;           
   delform.s_gsorgname.value = checkform.gsorgname.value; 

   delform.action='<%= response.encodeURL(request.getContextPath() + "/A400407.do") %>';
   delform.submit();
   return true;
   }
}
</script>

<%
	ResultProcess tOrgList = (ResultProcess)request.getAttribute("orgList");
	ArrayList tList = new ArrayList();
%>

<p><br></p>


<form name="orgform" method="post">
<input type="hidden" name="gs_org_id">	
<input type="hidden" name="gs_org_name">	
<input type="hidden" name="gs_org_addr">	
<input type="hidden" name="gs_org_post">	
<input type="hidden" name="gs_org_phone">	
<input type="hidden" name="gs_org_fax">	
<input type="hidden" name="gs_principal_name">	
<input type="hidden" name="gs_principal_phone">	
<input type="hidden" name="gs_principal_email">	
<input type="hidden" name="gs_upper_orgId">	
<input type="hidden" name="gsorgid">	
<input type="hidden" name="gsorgname">	
<input type="hidden" name="gs_is_stock">

<input type='hidden' name='s_gsorgid' value=''>
<input type='hidden' name='s_gsorgname' value=''>

<!--修改记录时保存翻页信息-->
<input type='hidden' name='s_pageNo' value=''>

</form>
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="20"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="1">
        <tr height="20">
          <td height="20" width="1" class="mtxt_black">&nbsp;</td>
          <td height="30" width="758" class="mtxt_black">组织机构管理</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bg_line" height="2"></td>
  </tr>
</table>

<br>

<!-- form start -->
<form name="checkform" method="get" onsubmit="if(!process()) return false;">

<!--修改记录时保存翻页信息-->
<%
if(tReQuery!=null && tReQuery.equals("true"))
{
	String s_pageNo = (String)request.getAttribute("s_pageNo");
	if (s_pageNo == null || s_pageNo.equalsIgnoreCase(""))
		s_pageNo = "1";
	
%>
	<input type='hidden' name='pageNo' value='<%=s_pageNo%>'>
<%
}
%>

<font id="err_font" name="err_font" color="#000000"><input type="hidden" name="hidden" value=""></font>
<table width="98%" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr> 
  <td valign="top" class="title">
 	
	  <table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
		<tr> 
		  <td class="bg_column"><font id="bank_id_font" color="#000000">机构编号&nbsp;</FONT></td>
		  <td align=left class="bg_row_odd">
		  	  <%
		  	  	String s_gsorgid = (String)request.getAttribute("s_gsorgid");
		  	  	if (s_gsorgid == null) s_gsorgid = request.getParameter("gsorgid");
		  	  	if (s_gsorgid == null) s_gsorgid = "";
		  	  %>
		  	  <input type="text" name="gsorgid" value="<%=s_gsorgid%>" maxLength=4 size="24"></input>
		  </td>
		  <td class="bg_column" align=center><font id="mer_id_font" color="#000000">机构名称&nbsp;</font></td>
		  <td align=left class="bg_row_odd">
		  	 <%
		  	 	String s_gsorgname = (String)request.getAttribute("s_gsorgname");
		  	  	if (s_gsorgname == null) s_gsorgname = request.getParameter("gsorgname");
		  	  	if (s_gsorgname == null) s_gsorgname = "";		  	 	
		  	 %>
             <input type="text" name="gsorgname" value="<%=s_gsorgname%>" maxLength=24 size="24"></input>
		  </td>
		  
		</tr>
		
	  </table>
	</td>
  </tr>
  <%
  if(tOrgList != null){
                    int totalRecords = 0;
                    int defaultPageSize = 10;
                    totalRecords = tOrgList.getRecordsSize();
              %>            
                <page:pager total='<%=totalRecords%>' defaultPageSize='<%=defaultPageSize%>'>
                <%tList = tOrgList.getDisplayRecords(index.intValue(),pageSize.intValue()); %>
                </page:pager>
                <%} %>
</table>
</form>
<p align="center">  
		<input type="button" class="kuang" value='查询' onclick="process('Q')"/>&nbsp;
    	<input type="button" class="kuang" value='清空' onclick="clean()"/>&nbsp;				
	
    </p>
<!-- form end -->
<center>
<!--
****************************显示列表*********************************************
-->

<%
	
	if(tOrgList != null){
%>
 <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
            <td> 
               
                <form name='pager' method="post">
			    <input type=hidden name="orgid" >
			
                <table class=bg_table id=tableId	cellspacing=1 cellpadding=2 width=98% align=center border=0>
                    <tbody> 
                    <tr class="bg_column" height=20> 
                        <td class=top align=middle> 
                            
                        </td>
                        <td class=top align=middle> 
                          
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">机构编号</div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">机构名称</div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">机构地址</div>
                        </td>
                        <td class=top align=middle> 
                           <div align="center" class="txt_content">机构邮编</div>
                        </td>
                        <td class=top align=middle> 
                           <div align="center" class="txt_content">机构电话</div>
                        </td>
						 <td class=top align=middle> 
                            <div align="center" class="txt_content">机构传真</div>
                        </td>
                         <td class=top align=middle> 
                            <div align="center" class="txt_content">负责人姓名</div>
                        </td>
                         <td class=top align=middle> 
                            <div align="center" class="txt_content">负责人电话</div>
                        </td>
                         <td class=top align=middle> 
                            <div align="center" class="txt_content">电子邮件</div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">是否订货</div>
                        </td>
                         <td class=top align=middle> 
                            <div align="center" class="txt_content">上级机构编号</div>
                        </td>
                    </tr>
                   <%
						if(tList != null && tList.size() > 0){
						for(int i=0; i<tList.size(); i++){
							String[] tStr = (String[])tList.get(i);
							String tTempStr="";
							if(i%2==0){
								tTempStr="class=\"bg_row_odd\"";
							}else {
								tTempStr="class=\"bg_row_even\"";
							}
					%>
                    <tr <%=tTempStr%> height=20>
                         <td class=top align=middle> 
                            <div align="center" class="txt_content">
                            <a href="A400405.do?orgid=<%=tStr[0] %>" target="_blank">
                            </a>
                            <input type="button" class="kuang" value='修改' onclick="mod('<%=tStr[0] %>')"/>
                            </div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">
                            
                            <input type="button" class="kuang" value='删除' onclick="del('<%=tStr[0] %>')"/>
                            </div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">
                            <%=tStr[0]%>
                            </div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">
                            <%=tStr[1]%>
                            </div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">
                            <%=tStr[2]%>
                            </div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">
                            <%=tStr[3]%>
                            </div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">
                            <%=tStr[4]%>
                            </div>
                        </td>
						<td class=top align=middle> 
                            <div align="center" class="txt_content">
                            <%=tStr[5]%>
                            </div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">
                            <%=tStr[6]%>
                            </div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">
                            <%=tStr[8]%>
                            </div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">
                            <%=tStr[7]%>
                            </div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">
                            <%=tStr[10]%>
                            </div>
                        </td>
                        <td class=top align=middle> 
                            <div align="center" class="txt_content">
                            <%=tStr[9]%>
                            </div>
                        </td>
                    </tr>
                  			
					<%	
							}
					%>
                     <tr class="bg_column" height=20>
					    <td width="960" height="16" colspan="13" align="right">
								<!--导航条-->
								<page:navigator type='text' queryForm="checkform"/>
					    </td>
					  </tr>	
					  <%
						}else{
					%>
							<font color="red">没有符合条件的组织机构</font>
					<%
						}
					%>
                    </tbody> 
                </table>
               </form>	
            </td>
        </tr>
    </table>
 
 
   <!--
****************************显示列表*********************************************
   -->
   
</center>

<form action="" name="delform" method="post">	
    <input type=hidden name=orgid>	
    <input type="hidden" name="s_gsorgid">	
    <input type="hidden" name="s_gsorgname">	
      
	<!--修改记录时保存翻页信息-->
	<input type='hidden' name='s_pageNo' value=''>
</form>

<p align="center">  
		<input type="button" class="kuang" value='增加' onclick="add()"/>&nbsp;
    </p>
<%} %>
                           
</body>
</html>
